Imports CapaDeDatos
Public Class nDetalleFacturaVenta
    Private Concepto As nConcepto = New nConcepto
    Private Remito As nRemitoServicios = New nRemitoServicios
    Private DetalleFacturaVenta As dDetalleFacturaVenta = New dDetalleFacturaVenta()
    Public Function Insertar(ByVal Subtotal As String, ByVal Total As String, ByVal IVA As String, ByVal idFactura As String, ByVal CodigoConcepto As String, ByVal CodigoRemito As String) As Boolean
        Return DetalleFacturaVenta.Insertar(Subtotal, Total, IVA, idFactura, CodigoConcepto, CodigoRemito)
    End Function
    Public Function Eliminar(ByVal idDetalleFactura As String, ByVal idFactura As String) As Boolean
        Return DetalleFacturaVenta.Eliminar(idDetalleFactura, idFactura)
    End Function
    Public Function BuscarFiltrado(ByVal idDetalleFactura As String, ByVal Subtotal As String, ByVal Total As String, ByVal IVA As String, ByVal idFactura As String, ByVal CodigoConcepto As String, ByVal CodigoRemito As String) As DataSet
        Dim dts As DataSet = DetalleFacturaVenta.BuscarFiltrado(idDetalleFactura, Subtotal, Total, IVA, idFactura, CodigoConcepto, CodigoRemito)
        dts.Tables(0).Columns.Add("Concepto")
        'Dim DtsSalida As DataSet
        Dim i As Integer
        For i = 0 To dts.Tables(0).Rows.Count - 1
            If dts.Tables(0).Rows(i)("CodigoRemito").ToString() = "" Then
                Try
                    dts.Tables(0).Rows(i)("Concepto") = Concepto.MostrarDescripcion(CInt(dts.Tables(0).Rows(i)("CodigoConcepto").ToString()), "")
                Catch ex As Exception
                    dts.Tables(0).Rows(i)("Concepto") = "Error, Concepto no Encontrado"
                End Try
            Else
                Try
                    dts.Tables(0).Rows(i)("Concepto") = Remito.BuscarFiltrado(dts.Tables(0).Rows(i)("CodigoRemito").ToString(), "", "", "", "", "", "", "", "").Tables(0).Rows(0)("Numero").ToString()
                Catch ex As Exception
                    dts.Tables(0).Rows(i)("Concepto") = "Error, Remito no Encontrado"
                End Try
            End If
        Next

        Return dts
    End Function
End Class
